{template 'common/header'}
<ul class="nav nav-tabs" id="myTab">
    <li>
		<a href="?c=home&a=welcome&do=ext&m={php echo $_GPC['m']}">返回</a>
	</li>
	<li><a href="{php echo $this->createWebUrl('credit',array('op'=>'goods'));}">礼品管理</a></li>
	<li class="active"><a href="{php echo $this->createWebUrl('credit_goods');}">添加礼品</a></li>
    <li><a href="{php echo $this->createWebUrl('credit',array('op'=>'record'))}">兑换请求管理</a></li>
</ul>
<div class="main">
<div class="panel panel-default">
<div class="panel-heading">编辑奖品</div>
<div class="panel-body">
  
	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
		<input type="hidden" name="id" value="{$item['goods_id']}" />
	    <div class="form-group">
	      <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">奖品名称</label>
	      <div class="col-sm-8 col-xs-12">
	        <input type="text" class="form-control" placeholder="" name="title" value="{$item['title']}">
	      </div>
	    </div>
	    <div class="form-group">
	      <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">宣传图<img src='http://appstore.xiaoheqingting.com/2289/padding.png' /></label>
	      <div class="col-sm-8 col-xs-12">
	        {php echo tpl_form_field_image('logo', $item['logo']);}
	      </div>
	    </div>
    <div class="form-group">
      <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">单用户最多可兑</label>
      <div class="col-sm-8 col-xs-12">
          <input type="text" class="form-control" placeholder="" name="per_user_limit" value="{$item['per_user_limit']}">
					<span class="help-block">此项设置该奖品每个用户可兑换件数，防止单个用户将奖品兑光。为0时表示不限件数。</span>
      </div>
    </div>
   <div class="form-group">
      <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">奖品剩余库存</label>
      <div class="col-sm-8 col-xs-12">
          <input type="text" class="form-control" placeholder="" name="amount" value="{$item['amount']}">
					<span class="help-block">此设置项设置该奖品剩余奖品数。为0时不对外显示，不接受兑换。</span>
      </div>
    </div>
   <div class="form-group">
      <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">兑奖截止日期<span class="red">*</span></label>
      <div class="col-sm-8 col-xs-12">
          {php echo tpl_form_field_date('deadline', !empty($item['deadline']) ? $item['deadline'] : date('Y-m-d H:i'), 1)}
					<span class="help-block">超过该日期后不可兑奖,并且自动从奖品列表中下架。</span>
      </div>
    </div>
   <div class="form-group">
      <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">奖品实际价格<span class="red">*</span></label>
      <div class="col-sm-8 col-xs-12">
          <input type="text" class="form-control" placeholder="" name="price" value="{$item['price']}">
					<span class="help-block">此设置项设置奖品价格。如100</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">兑换消耗积分数<span class="red">*</span></label>
      <div class="col-sm-8 col-xs-12">
          <input type="text" class="form-control" placeholder="" name="cost" value="{$item['cost']}">
					<span class="help-block">设置该奖品每兑换一次消耗的积分数。</span>
      </div>
    </div>
    <div class="form-group">
      <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">内容<span class="red">*</span></label>
      <div class="col-sm-8 col-xs-12">
		<textarea class="form-control richtext" name="content" rows="10">{$item['content']}</textarea>
      </div>
    </div>
    <div class="form-group">
      <div class="col-sm-12">
        <input name="submit" type="submit" value="提交" class="btn btn-primary col-lg-1">
        {if !empty($item['goods_id'])}<a class="btn btn-default " href="{php echo $this->createMobileUrl('Goods')}">预览</a>{/if}
        <input type="hidden" name="token" value="{$_W['token']}" />
      </div>
    </div>
	</form>
	</div>
</div>
</div>
<script type="text/javascript">
	require(['jquery', 'util'], function($, u){
		$(function(){
			u.editor($('.richtext')[0]);
		});
	});
</script>

{template 'common/footer'}